package com.haitaoit.chengquan.main;

/**
 * Created by 赵航 on 2017/11/28.
 * 这个更能提高性能，但是碍于很难看懂，并且还需要会引起其他代码的内存泄漏，因此，暂时不用了
 */

public class FragementFactory {
//    private static  HomeFragment   mHomeFragment;
//    private static NearFragment   mNearFragment;
//    private static CarFragment    mCarFragment;
//    private static SeverFragment  mSeverFragment;
//    private static CenterFragment mCenterFragment;
//
//    private static List<Fragment> fragmentList = new ArrayList<>();
//
//    public static Fragment porvideFragemet(int position) {
//
//        switch (position) {
//            case 0:
//                if (mHomeFragment == null) {
//                    mHomeFragment = new HomeFragment();
//                }
//                return mHomeFragment;
//            case 1:
//                if (mNearFragment == null) {
//                    mNearFragment = new NearFragment();
//                }
//                return mNearFragment;
//            case 2:
//                if (mCarFragment == null) {
//                    mCarFragment = new CarFragment();
//                }
//                return mCarFragment;
//            case 3:
//                if (mSeverFragment==null){
//                    mSeverFragment = new SeverFragment();
//                }
//                return mSeverFragment;
//            case 4:
//                if (mCenterFragment==null){
//                    mCenterFragment = new CenterFragment();
//                }
//                return mCenterFragment;
//        }
//
//        return null;
//    }
//    public static List<Fragment> getAllFragment(){
//        for (int i = 0; i < 4; i++) {
//            fragmentList.add(porvideFragemet(i));
//        }
//        return fragmentList;
//    }

}
